package org.jawa.dao;

import java.util.List;

import org.jawa.model.User;
import org.springframework.security.userdetails.UserDetails;
import org.springframework.security.userdetails.UsernameNotFoundException;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;


public interface UserDao extends Dao {
    public List<User> getUsers();
    public User getUser(Long userId);
    public User saveUser(User user);
    public void removeUser(Long userId);
    
    @Transactional
    UserDetails loadUserByUsername(String username) throws UsernameNotFoundException;
    
    /**
     * 获取User表中指用户名的用户密码
     * @param 用户名
     * @return the password in DB, if the user is already persisted
     */
    @Transactional(propagation = Propagation.NOT_SUPPORTED)
    String getUserPassword(String username);
}
